from ..json import json
from google.appengine.ext import db
from google.appengine.ext import webapp

class ProjNew(webapp.RequestHandler):
  def post(self):
    projName = self.request.post("projname")
    projIntro = self.request.post("projintro")
    if projName and projIntro:
      projInfo = ProjectInfo(projName=projName,
                             projIntro=projIntro)
      projInfo.put()
      message = {"result": "success"}
      self.response.out.write(json.write(message));
    else:
      message = {"result": "faild"}
      self.response.out.write(json.write(message));
  def get(self):
    self.response.out.write("It's a post interface, you should not vist it directly")
class ProjectInfo(db.Model):
  projName = db.StringProperty(required = True)
  projIntro = db.StringProperty(required = True)
    
